/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.gis.eemc.service;

import java.util.List;

import net.gis.eemc.dao.DepartmentDAO;
import net.gis.eemc.dao.DepartmentDAOImpl;
import net.gis.eemc.domain.Department;

/**
 *
 * @author Sergey
 */
public class DepartmentServiceImpl {

    DepartmentDAO depDAO;

    public DepartmentServiceImpl() {
        depDAO = new DepartmentDAOImpl();
    }

    public Boolean isDepartmentWithTitleExists(String Title) {
        List<Department> dep;
        dep = depDAO.getDepartmentWithTitle(Title);
        return !dep.isEmpty();
    }

    public Boolean isDepartmentWithShortNameExists(String ShortName) {
        List<Department> dep;
        dep = depDAO.getDepartmentWithShortName(ShortName);
        return !dep.isEmpty();
    }

    public List<Department> getDepartmentsForFaculty(Integer facID) {
        return depDAO.listDeptartment(facID);
    }

    public List<Department> getDepartments() {
        return depDAO.listDeptartment();
    }

    public Department getDepartments(Integer id) {
        return depDAO.getDepartmentWithID(id);
    }

    public void update(Department department) {
        depDAO.updateDepartment(department);
    }
}
